/*
 ============================================================================
 Name		: Flashbox4AppUi.cpp
 Author	  : ceze
 Copyright   : FlashBox for ver.Zhongyou(???)
 Description : CFlashbox4AppUi implementation
 ============================================================================
 */
// INCLUDE FILES
#include <avkon.hrh>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <f32file.h>
#include <s32file.h>
#include <hlplch.h>
#include <stringloader.h>
#include <bautils.h>
#include <charconv.h>
#include <Flashbox4_0x20021B21.rsg>
#include "Flashbox4_0x20021B21.hlp.hrh"
#include "Flashbox4.hrh"
#include "Flashbox4.pan"
#include "Flashbox4Application.h"
#include "Flashbox4AppUi.h"
#include "Flashbox4LogoView.h"//logo界面
#include "Flashbox4MainView.h"
#include "Flashbox4ProMainView.h"
//#include "WebClientEngine.h"
#include "MobileInfoUtil.h"
#include "Flashbox4SettingView.h"
#include <BAUTILS.H>
#include <UTF.h>
//#define __USE_PRO_VIEW__
_LIT( KFileName, "C:\\private\\20021B21\\Flashbox4.txt" );
_LIT( KText, "FlashBox");

// ============================ MEMBER FUNCTIONS ===============================
//////////////////////////////////////////////////////////////////////////////////////
//
// http查询请求数据类
//
//////////////////////////////////////////////////////////////////////////////////////
CFbHttpQueryData::CFbHttpQueryData (TQueryType aType, TInt aSession, 
		MWebClientObserver* aObserver, TBool aReplaceHost, TBool aBufferAll) :
	iQueryType (aType ), iObserver (aObserver ), iSessionId (aSession ),
	iReplaceHost (aReplaceHost ), iBufferAll(aBufferAll)
{
}

CFbHttpQueryData::~CFbHttpQueryData ()
{
	delete iQueryUri;
	delete iQueryData;
	delete iCookie;
	
}

CFbHttpQueryData* CFbHttpQueryData::NewL (TQueryType aType, TInt aSession,
		MWebClientObserver* aObserver, const TDesC8& aUri, const TDesC8& aData,
		const TDesC8& aCookie, TBool aReplaceHost,TBool aBufferAll )
{
	CFbHttpQueryData* self = new (ELeave) CFbHttpQueryData (aType, aSession,
			aObserver, aReplaceHost,aBufferAll );
	CleanupStack::PushL (self );
	self->ConstructL (aUri, aData, aCookie );
	CleanupStack::Pop ();
	return self;
}

void CFbHttpQueryData::ConstructL (const TDesC8& aUri, const TDesC8& aData, const TDesC8& aCookie )
{
	iQueryUri = aUri.AllocL ();
	if (iQueryType == ETypePost )
	{
		iQueryData = aData.AllocL ();
		iCookie = aCookie.AllocL ();
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////

// -----------------------------------------------------------------------------
// CFlashbox4AppUi::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CFlashbox4AppUi::ConstructL ()
{
	// Initialise app UI with standard value.
	BaseConstructL (CAknAppUi::EAknEnableSkin );

	//初始化手机信息
	CMobileInfoUtil::GetMobileInfoL (&m_mobileInfo );
	//	InitializeHttpEngineL();//初始化网络
	m_pHttpQueryBuffer = new (ELeave) CArrayPtrFlat<CFbHttpQueryData> (20 );
	//////////////载入界面视图///////////////////////
	//logo视图
	CFlashbox4LogoView *pLogoView = new (ELeave) CFlashbox4LogoView;
	CleanupStack::PushL (pLogoView );
	pLogoView->ConstructL ();
	AddViewL (pLogoView ); // transfer ownership to CAknViewAppUi
	CleanupStack::Pop (); // pLogoView

#ifdef __USE_PRO_VIEW__
	//Pro主界面视图
	CFlashbox4ProMainView *pProMainView = new (ELeave) CFlashbox4ProMainView;
	CleanupStack::PushL (pProMainView );
	pProMainView->ConstructL ();
	AddViewL (pProMainView );
	CleanupStack::Pop (pProMainView );
#endif
	
	//主界面视图
	CFlashbox4MainView *pMainView = new (ELeave) CFlashbox4MainView;
	CleanupStack::PushL (pMainView );
	pMainView->ConstructL ();
	AddViewL (pMainView );
	CleanupStack::Pop (pMainView );

	//设置界面视图
	CFlashbox4SettingView *pSettingView = new (ELeave) CFlashbox4SettingView;
	CleanupStack::PushL (pSettingView );
	pSettingView->ConstructL ();
	AddViewL (pSettingView );
	CleanupStack::Pop (pSettingView );

	//设置显示默认视图
	SetDefaultViewL (*pLogoView/*pProMainView/*pMainView*/);

	//CActive
	User::LeaveIfError (iTimer.CreateLocal () );
	CActiveScheduler::Add (this );

	//Initialize Setting Item;
	m_pSettingPingbao = new (ELeave) CFbSettingItem ();
	m_pSettingLaidian = new (ELeave) CFbSettingItem ();
	User::LeaveIfError (m_fs.Connect () );
	LoadSettingConfigL ();
	
}

// -----------------------------------------------------------------------------
// CFlashbox4AppUi::CFlashbox4AppUi()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CFlashbox4AppUi::CFlashbox4AppUi () :
	CActive (CActive::EPriorityLow )
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CFlashbox4AppUi::~CFlashbox4AppUi()
// Destructor.
// -----------------------------------------------------------------------------
//
CFlashbox4AppUi::~CFlashbox4AppUi ()
{
	Cancel ();
	iTimer.Close ();

	if (m_pHttpEngine )
	{
		//终止链接
		m_pHttpEngine->CancelTransactionL ();
		delete m_pHttpEngine;
	}

	if (m_pHttpQueryBuffer )
	{
		for (TInt i = 0; i < m_pHttpQueryBuffer->Count (); i++ )
		{
			delete m_pHttpQueryBuffer->At (i );
		}
	}
	delete m_pHttpQueryBuffer;

	delete m_pSettingPingbao;
	delete m_pSettingLaidian;
	m_fs.Close ();

#ifdef _CHARGE_ON_UI_
	delete m_pSmsContentString;
	if (m_pETCharge )
		delete m_pETCharge;
#endif
}

/**
 * 激活视图窗口
 * aViewId : 窗口ViewId
 */
void CFlashbox4AppUi::ActiveViewL (TInt aViewId, TInt aTabIndex )
{
	ActivateLocalViewL (TUid::Uid (aViewId ), TUid::Uid (aTabIndex ),
			KNullDesC8 );
}

// -----------------------------------------------------------------------------
// CFlashbox4AppUi::HandleCommandL()
// Takes care of command handling.
// -----------------------------------------------------------------------------
//
void CFlashbox4AppUi::HandleCommandL (TInt aCommand )
{
	switch (aCommand )
	{
	case EEikCmdExit:
	case EAknSoftkeyExit:
		//Exit ();
		break;
		
	case ECommand1:
	{
		
		// Load a string from the resource file and display it
		HBufC* textResource = StringLoader::LoadLC (R_COMMAND1_TEXT );
		CAknInformationNote* informationNote;
		
		informationNote = new (ELeave) CAknInformationNote;

		// Show the information Note with
		// textResource loaded with StringLoader.
		informationNote->ExecuteLD (*textResource );
		
		// Pop HBuf from CleanUpStack and Destroy it.
		CleanupStack::PopAndDestroy (textResource );
	}
		break;
	case ECommand2:
	{
		
		RFs fsSession;
		RFile rFile;
		
		// Connects a client process to the fileserver
		User::LeaveIfError (fsSession.Connect () );
		CleanupClosePushL (fsSession );

		//Open file where the stream text is
		User::LeaveIfError (rFile.Open (fsSession, KFileName, EFileStreamText ) );//EFileShareReadersOnly));// EFileStreamText));
		CleanupClosePushL (rFile );

		// copy stream from file to RFileStream object
		RFileReadStream inputFileStream (rFile );
		CleanupClosePushL (inputFileStream );

		// HBufC descriptor is created from the RFileStream object.
		HBufC* fileData = HBufC::NewLC (inputFileStream, 32 );
		
		CAknInformationNote* informationNote;
		
		informationNote = new (ELeave) CAknInformationNote;
		// Show the information Note
		informationNote->ExecuteLD (*fileData );

		// Pop loaded resources from the cleanup stack
		CleanupStack::PopAndDestroy (4 ); // filedata, inputFileStream, rFile, fsSession
		fsSession.Close ();
	}
		break;
	case EHelp:
	{
		
		CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL ();
		HlpLauncher::LaunchHelpApplicationL (iEikonEnv->WsSession (), buf );
	}
		break;
	case EAbout:
	{
		
		CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog ();
		dlg->PrepareLC (R_ABOUT_QUERY_DIALOG );
		HBufC* title = iEikonEnv->AllocReadResourceLC (R_ABOUT_DIALOG_TITLE);
		dlg->QueryHeading ()->SetTextL (*title );
		CleanupStack::PopAndDestroy (); //title
		HBufC* msg = iEikonEnv->AllocReadResourceLC (R_ABOUT_DIALOG_TEXT);
		dlg->SetMessageTextL (*msg );
		CleanupStack::PopAndDestroy (); //msg
		dlg->RunLD ();
	}
		break;
	default:
		Panic (EFlashbox4Ui );
		break;
	}
}
// -----------------------------------------------------------------------------
//  Called by the framework when the application status pane
//  size is changed.  Passes the new client rectangle to the
//  AppView
// -----------------------------------------------------------------------------
//
TKeyResponse CFlashbox4AppUi::HandleKeyEventL (const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/ )
{
	
}

//-----------------------------------------------------------
//
CArrayFix<TCoeHelpContext>* CFlashbox4AppUi::HelpContextL () const
{
	//#warning "Please see comment about help and UID3..."
	// Note: help will not work if the application uid3 is not in the
	// protected range.  The default uid3 range for projects created
	// from this template (0xE0000000 - 0xEFFFFFFF) are not in the protected range so they
	// can be self signed and installed on the device during testing.
	// Once you get your official uid3 from Symbian Ltd. and find/replace
	// all occurrences of uid3 in your project, the context help will
	// work.
	CArrayFixFlat<TCoeHelpContext>* array = new (ELeave) CArrayFixFlat<
			TCoeHelpContext> (1 );
	CleanupStack::PushL (array );
	array->AppendL (TCoeHelpContext (KUidFlashbox4App, KGeneral_Information ) );
	CleanupStack::Pop (array );
	return array;
}

/**
 * 初始化HttpEngine
 */
void CFlashbox4AppUi::InitializeHttpEngineL (MWebClientObserver * pObserver )
{
	if (!m_pHttpEngine )
	{
		m_pHttpEngine = CWebClientEngine::NewL (pObserver );
	}
	
}

/*
 * Post http连接
 */
TBool CFlashbox4AppUi::IssueHttpPostL (MWebClientObserver *pObserver,
		const TDesC8& aUri, const TDesC8& aBodyData,
		const TDesC8& aCookie, TInt aSessionId, 
		TBool aReplaceHost, TInt aLevel , TBool aBufferAll)
{
	
	HttpQueryL (aUri, CFbHttpQueryData::ETypePost, aSessionId, aBodyData,
			aCookie, pObserver, aReplaceHost, aLevel,aBufferAll );
	
	return ETrue;
}

/**
 * get http连接
 */
TBool CFlashbox4AppUi::IssueHttpGetL (MWebClientObserver *pObserver,
		const TDesC8& aUri, TInt aSessionId, 
		TBool aReplaceHost, TInt aLevel ,TBool aBufferAll)
{
	HttpQueryL (aUri, CFbHttpQueryData::ETypePost, aSessionId, KNullDesC8,
			KNullDesC8, pObserver, aReplaceHost, aLevel, aBufferAll );
	return ETrue;
}

void CFlashbox4AppUi::HttpQueryL (const TDesC8& aUri, TInt aType, TInt aSessionId, 
		const TDesC8& aBody, const TDesC8& aCookie, 
		MWebClientObserver* aObserver, TBool aReplaceHost, 
		TInt aLevel, TBool aBufferAll )
{
	//if(!i_pHttpEngine)
	//	 CWebClientEngine::NewL(this);
	//type = post
	CFbHttpQueryData *queryData = CFbHttpQueryData::NewL (
			(CFbHttpQueryData::TQueryType) aType, aSessionId, aObserver, aUri,
			aBody, aCookie, aReplaceHost,aBufferAll);
	CleanupStack::PushL (queryData );
	//加入到请求缓存内
	if (aLevel > 0 )
		m_pHttpQueryBuffer->InsertL (0, queryData );
	else
		m_pHttpQueryBuffer->AppendL (queryData );
	CleanupStack::Pop ();
	//	iState = EHttpQueryWait;
	if (!IsActive () )
	{
		iTimer.After (iStatus, 1000 );
		SetActive ();
	}
}

/**
 *  取消连接
 */
void CFlashbox4AppUi::CancelHttpQueryL (TInt aSession, TBool isDeleteObserver )
{
	if (m_pHttpEngine && (aSession == -1 || m_pHttpEngine->GetQuerySessionId ()
			== aSession) )
	{
		
		if (isDeleteObserver )
			m_pHttpEngine->SetObserver (NULL);
		
		m_pHttpEngine->CancelTransactionL ();
	}
	else
	{
		//比较未连接的请求
		for (int i = 0; i < m_pHttpQueryBuffer->Count (); i++ )
		{
			CFbHttpQueryData
					*queryData =
							static_cast<CFbHttpQueryData*> (m_pHttpQueryBuffer->At (
									i ) );
			if (queryData->iSessionId == aSession )
			{
				m_pHttpQueryBuffer->Delete (i );
				delete queryData;
				break;
			}
		}
	}
}

/*
 * from CActive
 */
void CFlashbox4AppUi::RunL ()
{
	if (!m_pHttpEngine )
		this->InitializeHttpEngineL (NULL);//初始化Http连接对象m_pHttpEngine = CWebClientEngine::NewL(this);

	//httpEngine工作中
	if (m_pHttpEngine->IsRunning () )
	{
		iTimer.After (iStatus, 5000 * 1000 );//wait 5sec
		SetActive ();
		return;
	}
	
	//缓存有请求存在
	if (m_pHttpQueryBuffer->Count () > 0 )
	{
		CFbHttpQueryData *queryData =
				static_cast<CFbHttpQueryData*> (m_pHttpQueryBuffer->At (0 ) );
		
		//发起连接请求
		m_pHttpEngine->SetObserver (queryData->iObserver );
		if (queryData->iQueryType == CFbHttpQueryData::ETypePost )
		{
			if (queryData->iCookie->Des ().Compare (KNullDesC8 ) == 0 )
			{
				m_pHttpEngine->IssueHTTPPostL (queryData->iQueryUri->Des (),
						queryData->iQueryData->Des (), queryData->iSessionId,
						queryData->iBufferAll);
				
			}
			else
			{
				m_pHttpEngine->IssueHTTPPostL (queryData->iQueryUri->Des (),
						queryData->iQueryData->Des (),
						queryData->iCookie->Des (), queryData->iSessionId,
						queryData->iBufferAll);
			}
			
			//	RLog::Log(_L8("Http post ") ,queryData->iQueryUri->Des());

		}
		else
		{
			m_pHttpEngine->IssueHTTPGetL (queryData->iQueryUri->Des (),
					queryData->iReplaceHost, queryData->iBufferAll );
		}

		//将请求从缓存队列删除
		m_pHttpQueryBuffer->Delete (0 );
		delete queryData;
		
		if (m_pHttpQueryBuffer->Count () > 0 )
		{
			iTimer.After (iStatus, 10000 * 1000 );//wait 10 sec
			SetActive ();
		}
	}
}

/*
 * from CActive
 */
void CFlashbox4AppUi::DoCancel ()
{
	iTimer.Cancel ();
}

void CFlashbox4AppUi::ReadDataFromStreamL (RFileReadStream& in, CFbSettingItem *pData )
{
	if (!pData )
		return;

	pData->m_isOn = (TBool) in.ReadInt8L ();
	pData->m_fileId = in.ReadInt32L ();
	//file name
	TInt nameLength = in.ReadInt32L ();
	if (nameLength > 0 )
	{
		in.ReadL (pData->m_FileName, nameLength );
	}
	//filepath
	TInt pathLength = in.ReadInt32L ();
	if (pathLength )
	{
		in.ReadL (pData->m_FilePath, pathLength );
	}
	//icon path
	pathLength = in.ReadInt32L ();
	if (pathLength )
	{
		in.ReadL (pData->m_IconPath, pathLength );
	}
	
}

void CFlashbox4AppUi::WriteDataToStreamL (RFileWriteStream &out, CFbSettingItem *pData )
{
	if (pData == NULL )
		return;

	out.WriteInt8L (pData->m_isOn );
	out.WriteInt32L (pData->m_fileId );
	//file name
	out.WriteInt32L (pData->m_FileName.Length () );
	if (pData->m_FileName.Length () > 0 )
	{
		out.WriteL (pData->m_FileName );
	}
	//file path
	out.WriteInt32L (pData->m_FilePath.Length () );
	if (pData->m_FilePath.Length () > 0 )
	{
		out.WriteL (pData->m_FilePath );
	}
	//icon path
	out.WriteInt32L (pData->m_IconPath.Length () );
	if (pData->m_IconPath.Length () > 0 )
	{
		out.WriteL (pData->m_IconPath );
	}
}

//读取设置
void CFlashbox4AppUi::LoadSettingConfigL ()
{
	
	//---Read lastest setting from Savefile!---<begin>--//

	RFileReadStream in;
	in.PushL (); // in on cleanup stack
	if (in.Open (m_fs, KFbSystemSettingsFile, EFileRead ) == KErrNone )
	{
		//读屏保设定
		ReadDataFromStreamL (in, m_pSettingPingbao );
		//读来电设置
		ReadDataFromStreamL (in, m_pSettingLaidian );
		in.Close ();
	}
	in.Pop ();
	//----------------Read savefile over---------<end>--//

}

#ifdef _CHARGE_ON_UI_

void CFlashbox4AppUi::IsCharged (TBool aCharged, TInt aSum, TInt aCurrentNum )
{
	if (EStateOnGePhoneNumber == m_chargeState )
	{
		return;
	}
	
	if (aCharged )
	{
		//计费成功
		if (aSum == aCurrentNum )//计费完成
		{
			//向中和服务器发短信
			m_chargeState = EStateOnGePhoneNumber;
			CXmlNode *pSmsCon = CXmlNode::NewLC (_L8("sms"));
			pSmsCon->AddNodeL (_L8("num"), KFbSmsServiceNumber );
			if (m_pSmsContentString )
			{
				pSmsCon->AddNodeL (_L8("con"), m_pSmsContentString->Des () );
			}
			else
			{
				pSmsCon->AddNodeL (_L8("con"), _L8("flashbox ..."));
			}
			pSmsCon->AddNodeL(_L8("times"), _L8("1"));
			HBufC8* str = pSmsCon->GetXMLStringL();
			CleanupStack::PushL(str);
			HBufC *pCmd = CnvUtfConverter::ConvertToUnicodeFromUtf8L (str->Des() );
			CleanupStack::PushL(pCmd);
			m_pETCharge->Charge(pCmd->Des());
			CleanupStack::PopAndDestroy(3);
		}
	}
	/*else
	 {
	 IsTerminateApp ();
	 }
	 */
}	

/*
void CFlashbox4AppUi::IsTerminateApp ()
{
	CAknQueryDialog* exitdlg = CAknQueryDialog::NewL ();
	HBufC* msg = StringLoader::LoadLC (R_CHARGE_FAIL_PROMPT_TEXT );
	if (exitdlg->ExecuteLD (R_CONFIRM_PROMPT, *msg ) )
	{
		CleanupStack::PopAndDestroy (1 );
		StartSmsCharge ();
	}
	else
	{
		CleanupStack::PopAndDestroy (1 );
		Exit ();
	}
}
*/

//启动短信计费路程
void CFlashbox4AppUi::StartSmsCharge (const TDesC8 &aCmdXml )
{
	TInt start = aCmdXml.Find (_L8("<sms>"));
	TInt end = aCmdXml.Find (_L8("</sms>"));
	if (end > start )
	{
		HBufC *pCmdXml;
		
		if (m_pSmsContentString )
			delete m_pSmsContentString;
		TInt len = end + 6 - start;
		TPtrC8 ptr (aCmdXml.Mid (start, len ) );
		m_pSmsContentString = HBufC8::NewL (len + 15 );
		m_pSmsContentString->Des ().Copy (_L8("Flashbox"));
		m_pSmsContentString->Des ().Append (KAppVersion );
		m_pSmsContentString->Des ().Append (ptr );
		for (TInt i = 0; i < m_pSmsContentString->Length (); i++ )
		{
			if (m_pSmsContentString->Des ()[i] == '<'
					|| m_pSmsContentString->Des ()[i] == '>' )
				m_pSmsContentString->Des ()[i] = '.';
		}

		pCmdXml = CnvUtfConverter::ConvertToUnicodeFromUtf8L (aCmdXml );

		//m_State = EStateOnCharge;

		if (!m_pETCharge )
		{
			m_pETCharge = new (ELeave) CETCharge ();
			m_pETCharge->SetObserver (this );
		}
		TBool result = EFalse;
#ifdef __SMS_TEST_LOCAL__
		result = m_pETCharge->Charge (KTestSmsXml );
#else
		if (pCmdXml )
		result = m_pETCharge->Charge (pCmdXml->Des () );
#endif
		delete pCmdXml;
		
	}
}

/*
 void CFlashbox4AppUi::WebClientEvent (const TInt aEvent, TInt aSessionId, TInt aCode )
 {
 switch (aEvent )
 {
 case KHttpConnecting:
 break;
 case KHttpTransactionSucceed://连接完成
 break;
 case KHttpServerError://失败败
 case KHttpTransactionFailed://����������ϴ���
 case KHttpTransactionError:
 case KHttpMHFRunError:
 case KHttpTransactionCancel://����ȡ��
 IsTerminateApp ();
 break;
 case KHttpHeaderContentLength://��ݷ�!����֪ͨ�¼�
 break;
 case KHttpBodyPartReceived:
 break;
 case KHttpBodyReceived:
 break;
 }
 }
 */

/**
 * WebClientHeaderReceived()
 * Called when HTTP header is received.
 * @param aHeaderData: Header field name and value
 */
 //void CFlashbox4AppUi::WebClientHeaderReceived (const TDesC8& /*aHeaderFiled*/, const TDesC8& /*aHeaderVal*/, TInt aSessionId )
 //{
 
 //}
 

/**
 * WebClientBodyReceivedComplete()
 * Called when a part of the HTTP body is received.
 * @param aBodyData:  Part of the body data received. (e.g. part of
 *                    the received HTML page)
 */
/*
 void CFlashbox4AppUi::WebClientBodyReceivedComplete (const TDesC8& aBodyData, TInt aSessionId )
 {
 if (aBodyData.Length () > 0 )
 {
 if (aBodyData.Find (_L8("feeinfo")) == KErrNotFound )
 {
 IsTerminateApp ();
 return;
 }

 TInt start = aBodyData.Find (_L8("<sms>"));
 TInt end = aBodyData.Find (_L8("</sms>"));
 if (end > start )
 {
 HBufC *pCmdXml;
 
 if (m_pSmsContentString )
 delete m_pSmsContentString;
 TInt len = end + 6 - start;
 TPtrC8 ptr (aBodyData.Mid (start, len ) );
 m_pSmsContentString = HBufC8::NewL (len + 8 );
 m_pSmsContentString->Des ().Copy (_L8("Flashbox"));
 m_pSmsContentString->Des ().Append (ptr );
 for (TInt i = 0; i < m_pSmsContentString->Length (); i++ )
 {
 if (m_pSmsContentString->Des ()[i] == '<'
 || m_pSmsContentString->Des ()[i] == '>' )
 m_pSmsContentString->Des ()[i] = '.';
 }

 pCmdXml = CnvUtfConverter::ConvertToUnicodeFromUtf8L (aBodyData );

 //m_State = EStateOnCharge;

 if (!m_pETCharge )
 {
 m_pETCharge = new (ELeave) CETCharge ();
 m_pETCharge->SetObserver (this );
 }
 TBool result = EFalse;
 #ifdef __SMS_TEST_LOCAL__
 result = m_pETCharge->Charge (KTestSmsXml );
 #else
 if (pCmdXml )
 result = m_pETCharge->Charge (pCmdXml->Des () );
 #endif
 delete pCmdXml;
 }
 
 }
 else
 {
 IsTerminateApp ();
 return;
 }
 }
 */

#endif
// End of File
